<?php
	// pr($category);
?>

<ul class="breadcrumb">
  <li><a href="<?php echo $this->webroot;?>">Home</a><span class="divider">/</span></li>
  <li><a href="<?php echo $this->webroot;?>Categories/index"><?php echo __("Lista categorie") ?></a><span class="divider">/</span></li>
  <li class="active"><?php echo __("Modifica categoria"); ?></li>
</ul>

<form action="<?php echo $this->webroot;?>Categories/save" method="post">

	<fieldset>
	    <legend>
			<h4><?php echo $category['Category']['id'];?></h4>
	    </legend>
	    <input type='hidden' name='Category[id]' value='<?php echo $category['Category']['id'];?>' />
		<div class="tabbable"> <!-- Only required for left/right tabs -->
		  <ul class="nav nav-tabs">
		    <li class="active"><a href="#tab1" data-toggle="tab"><?php echo __("Italiano") ?></a></li>
		    <li><a href="#tab2" data-toggle="tab"><?php echo __("Inglese") ?></a></li>
		  </ul>
		  <div class="tab-content">
		    <div class="tab-pane active" id="tab1">
				<label><?php echo __("Descrizione") ?></label>
				<input type="text" name="CategoryLang[ita][name]" value="<?php echo $category['CategoryLang']['ita']['name'];?>" />
			  	<input type="hidden" name="CategoryLang[ita][id]" value="<?php echo $category['CategoryLang']['ita']['id'];?>" >
			</div>
	    	<div class="tab-pane" id="tab2">
				<label><?php echo __("Descrizione") ?></label>
				<input type="text" name="CategoryLang[eng][name]" value="<?php echo $category['CategoryLang']['eng']['name'];?>" />
			  	<input type="hidden" name="CategoryLang[eng][id]" value="<?php echo $category['CategoryLang']['eng']['id'];?>" >
		  	</div>
		  </div>
		</div> 
		<div>
			<label>Categoria padre</label>
			<select name='Category[parent_id]'>
				<option value=''></option>";
				<?foreach ($categories as $key => $parentCategory) {?>
					<option value='<? echo $key?>'<? if($key == $category['Category']['parent_id']) echo " selected='selected' " ?> ><? echo $parentCategory ?></option>";
				<? } ?> 
			</select>
		</div>		
		<div>
			<label><?php echo __("Codice") ?></label>
			<input type="text" name="Category[code]" value="<?php echo $category['Category']['code'];?>"  />
		</div>		
	    <p>
			<a href='<?php echo $this->webroot;?>Categories/add' class="btn" ><i class='icon-plus'></i></a>
			<button type="submit" class="btn btn-primary"><i class='icon-ok'></i></button>
		</p>
	</fieldset>

</form>